package com.ruoyi.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.domain.Governmentemployee;
import com.ruoyi.service.IGovernmentemployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * GovernmentemployeeController
 * 
 * @author wjy
 * @date 2025-01-11
 */
@RestController
@RequestMapping("/governmentemployee")
public class GovernmentemployeeController extends BaseController
{
    @Autowired
    private IGovernmentemployeeService governmentemployeeService;

    /**
     * 查询Governmentemployee列表
     */
    @RequiresPermissions("governmentemployee:governmentemployee:list")
    @GetMapping("/list")
    public TableDataInfo list(Governmentemployee governmentemployee)
    {
        startPage();
        List<Governmentemployee> list = governmentemployeeService.selectGovernmentemployeeList(governmentemployee);
        return getDataTable(list);
    }

    /**
     * 导出Governmentemployee列表
     */
    @RequiresPermissions("governmentemployee:governmentemployee:export")
    @Log(title = "Governmentemployee", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Governmentemployee governmentemployee)
    {
        List<Governmentemployee> list = governmentemployeeService.selectGovernmentemployeeList(governmentemployee);
        ExcelUtil<Governmentemployee> util = new ExcelUtil<Governmentemployee>(Governmentemployee.class);
        util.exportExcel(response, list, "Governmentemployee数据");
    }

    /**
     * 获取Governmentemployee详细信息
     */
    @RequiresPermissions("governmentemployee:governmentemployee:query")
    @GetMapping(value = "/{govEid}")
    public AjaxResult getInfo(@PathVariable("govEid") Long govEid)
    {
        return success(governmentemployeeService.selectGovernmentemployeeByGovEid(govEid));
    }

    /**
     * 新增Governmentemployee
     */
    @RequiresPermissions("governmentemployee:governmentemployee:add")
    @Log(title = "Governmentemployee", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Governmentemployee governmentemployee)
    {
        return toAjax(governmentemployeeService.insertGovernmentemployee(governmentemployee));
    }

    /**
     * 修改Governmentemployee
     */
    @RequiresPermissions("governmentemployee:governmentemployee:edit")
    @Log(title = "Governmentemployee", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Governmentemployee governmentemployee)
    {
        return toAjax(governmentemployeeService.updateGovernmentemployee(governmentemployee));
    }

    /**
     * 删除Governmentemployee
     */
    @RequiresPermissions("governmentemployee:governmentemployee:remove")
    @Log(title = "Governmentemployee", businessType = BusinessType.DELETE)
	@DeleteMapping("/{govEids}")
    public AjaxResult remove(@PathVariable Long[] govEids)
    {
        return toAjax(governmentemployeeService.deleteGovernmentemployeeByGovEids(govEids));
    }
}
